package com.song.dubbpcustomer.controller;

import com.song.dubboapi.service.TestService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Song Yinghui
 * @date 2018/8/30
 * @Version 1.0
 */
@RestController
public class TestController implements InitializingBean {

    @DubboReference
    TestService testService;


    @GetMapping(value = "/test")
    String sayhello() {
        return testService.getServerinfo("this is client");
    }

    @GetMapping(path = "/rpc")
    public String init(){
        for (int i = 0; i < 100; i++) {
            String client = testService.getServerinfo("client");
            System.out.println(client);
        }
        return "3131";
    }

    @Override
    public void afterPropertiesSet() throws Exception {

    }
}
